<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //元素加载完触发
        window.onload=function(){
            var div = document.querySelector('div');
            console.log(div);
        }
        //窗口大小变化触发
        window.onresize=function(){
            console.log(111);
        }
    </script>
    <div></div>
</body>
</html>